package com.yand.controller.job;


import com.github.pagehelper.PageInfo;
import com.yand.api.entity.job.TSysJob;
import com.yand.api.entity.system.TSysRole;
import com.yand.api.service.job.JobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;


/**
 * 定时任务相关控制器类
 */
@Api(tags = "定时任务相关")
@RestController
@RequestMapping("job")
public class JobController {

    @Autowired
    private JobService jobService;


    /**
     * 跳转任务管理列表页面
     * @return
     */
    @ApiOperation("跳转任务列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "job", value = "任务", required = true)
    })
    @GetMapping("/job")
    public ModelAndView toRolePage(TSysJob job, Model model){

        ModelAndView modelAndView = new  ModelAndView();
        modelAndView.setViewName("job/job-list");

        PageInfo<TSysJob> jobPageInfo = jobService.queryRoleList(job);

        model.addAttribute("pageInfo",jobPageInfo);

        return modelAndView;
    }

}
